package com.taptech.doufu.net.httputils;

import com.taptech.doufu.listener.HttpResponseListener;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * 
 <p>
 * Company: DiaoBao
 * </p>
 * 
 * 
 @author huangzh
 * 
 * 
 @date 2014-3-17
 */
public class HttpRequestObject {
	private int handleType;
	private String url;
	private HttpResponseListener listener;
	private List<NameValuePair> data;
	private int pageIndex;
	private Object requestData;
	private String sexType;

	public String getSexType() {
		return sexType;
	}

	public void setSexType(String sexType) {
		this.sexType = sexType;
	}

	public int getHandleType() {
		return handleType;
	}

	public void setHandleType(int handleType) {
		this.handleType = handleType;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url.replaceAll("\\s+" , "");

	}

	public HttpResponseListener getListener() {
		return listener;
	}

	public void setListener(HttpResponseListener listener) {
		this.listener = listener;
	}

	public List<NameValuePair> getData() {
		return data;
	}

	public void setData(Map<String, String> data) {

		List<NameValuePair> lsit = new LinkedList<NameValuePair>();
		Iterator<String> it = data.keySet().iterator();
		NameValuePair value;
		while (it.hasNext()) {
			String key = (String) it.next();
			value = new BasicNameValuePair(key, data.get(key));
			lsit.add(value);
		}
		this.data = lsit;
	}


	public void setData(List<NameValuePair> data) {
		this.data = data;
	}


	public int getPageIndex() {
		return pageIndex;
	}

	public void setPageIndex(int pageIndex) {
		this.pageIndex = pageIndex;
	}

	public Object getRequestData() {
		return requestData;
	}

	public void setRequestData(Object requestData) {
		this.requestData = requestData;
	}

}
